package com.lijing.hannoTower;

/**
 * @Description TODO
 * @title: HannoTower
 * @Author LiJing
 * @Date: 2021/4/11:15 上午
 * @Version 1.0
 */
public class HannoTower {
    public static void main(String[] args) {
        hannoCal(3,'a','b','c');
    }

    /**
     *
     * @param num 盘子数量
     * @param a 柱子a
     * @param b b
     * @param c c
     */
    public static void hannoCal(int num, char a, char b, char c){
        if (num == 1){
            System.out.println(a + "-->" + c);
        }else {
            /*
             * @Date: 2021/4/1 1:18 上午
             * Step 1: 将上层num-1看做一个整体，现将a-->b,再将a-->c,再将b-->c
             */
            hannoCal(num-1, a,c,b);
            System.out.println(a + "-->" + c);
            hannoCal(num-1, b,a,c);
        }
    }
}
